<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:composition template="/template/layout.xhtml">
		<ui:define name="conteudo">
		<br/><br/>
		<div id="path">
			<h1>Novo Tópico</h1>
			<hr />			
		</div>		
		<h:form><br/><br/><br/>
		<fieldset>
			<legend>Dados</legend>
			<br /><br/>
			<h:panelGrid columns="3">
				<h:outputLabel value="Título:" for="titulo" styleClass="label"/>
				<h:inputText id="titulo" class="rotulos" size="70" value="#{forumBean.topico.titulo}" required="true" requiredMessage="* O campo [Título] é obrigatório!"/>
				<h:message for="titulo" showSummary="true" showDetail="false" class="error"/>
				
				<h:outputLabel value="Mensagem:" for="mensagem" styleClass="label"/>
				<h:inputTextarea id="mensagem" class="rotulos" size="40" value="#{forumBean.topico.mensagem}" required="true" requiredMessage="* O campo [Mensagem] é obrigatório!"/>
				<h:message for="mensagem" showSummary="true" showDetail="false" class="error"/>
		    </h:panelGrid>
		    
    		<br /><br/>
    		<h:commandButton class="botaolimpar" value="Limpar" image="../resources/imagens/botoes/botao-limpar.png" immediate="true">
			<f:ajax render="@form"></f:ajax>	
			</h:commandButton>	
            <h:commandButton class="botaosalvar" value="Salvar" image="../resources/imagens/botoes/botao-salvar.png" action="#{forumBean.cadastrarTopico}" >
            	<f:setPropertyActionListener target="#{forumBean.topico.usuario}" value="#{loginBean.usuario}" />            	
            </h:commandButton>	      		
		</fieldset>
		</h:form>
		</ui:define>
	</ui:composition>
</html>